package com.csun.cmny.core.support;

import lombok.Data;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-09-19 15:57
 * @Description: the class map result handler
 */
public class MapResultHandler implements ResultHandler {

    private final Map result = new HashMap();

    @Override
    public void handleResult(ResultContext resultContext) {

        Map map = (Map) resultContext.getResultObject();

        // xml配置里面的property的值，对应的列
        result.put(map.get("key"), map.get("value"));
    }

    public Map getResult() {

        return result;
    }
}
